package com.eckey.lab.controller;

import com.alibaba.fastjson.JSON;
import com.eckey.lab.bean.User;
import com.eckey.lab.common.ResultData;
import com.eckey.lab.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Marinc
 * @CreateTime: 2024-06-17  14:46
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/user/")
public class UserController {


    @Autowired
    private UserService userService;


    @PostMapping("/add")
    public ResultData add(@RequestBody User user) {
        log.info("新增用户信息：{}",JSON.toJSONString(user));
        return userService.addUser(user);
    }

    @GetMapping("/queryById/")
    public ResultData queryById(@RequestParam("id")Long id) {
        return userService.queryById(id);
    }


}
